const {app, BrowserWindow} = require("electron");
const isDev = require("electron-is-dev");
const path = require("path");
let win
const createMainWindow = async function () {
    win = new BrowserWindow({
        width: 1000,
        height: 700,
        webPreferences: {
            nodeIntegration: true
        }
    })
    if (isDev) {
        let res = await win.loadURL("http://localhost:3000")
        win.webContents.openDevTools()
    } else {
        win.loadURL(path.resolve(__dirname, '../../renderer/pages/main/index.html'));
    }
}


const send = function (channel, ...args) {
    win.webContents.send(channel, ...args)
}

module.exports = {createMainWindow, send}
